﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DAL;
using BLL;
using System.Collections.Generic;

public partial class Baiviet_ListGroup : System.Web.UI.UserControl
{
    THANHVIENBLL tvBll = new THANHVIENBLL();
    BAIVIETBLL bvBll = new BAIVIETBLL();

    protected void Page_Load(object sender, EventArgs e)
    {
        showGroup();
    }

    public void showGroup() {
        string mabaiviet = Page.Request["mabv"].ToString();

        THANHVIEN tv_vietbai = tvBll.getThanhvienWithIDBaiviet(Int32.Parse(mabaiviet));
        THANHVIEN tv_visitor = (THANHVIEN)Session["thanhvienObject"];

        List<THANHVIEN> ListTV = bvBll.getThanhviensInGroupWithIDBaiviet(Int32.Parse(mabaiviet));

        string str_inner = "<ul class=\"ul_bot\">";
        foreach (THANHVIEN tv in ListTV)
        {
            if (tv_vietbai.mathanhvien.Equals(tv_visitor.mathanhvien))
            {
                if (tv.mathanhvien.Equals(tv_vietbai.mathanhvien))
                {
                    str_inner += "<li><img style=\"cursor:pointer\" onclick=\"processList(" + tv.mathanhvien + "," + mabaiviet + ")\" src=\"images/icon/001_01_2.png\"/><a style=\"text-decoration:none\" href=\"#\">&nbsp;&nbsp;&nbsp;" + tv.tenthanhvien + "</a></li>";
                }
                else {
                    str_inner += "<li><img  alt=\"Xóa người này vào danh sách chat trong bài viết\" style=\"cursor:pointer\" onclick=\"processGroup(" + tv.mathanhvien + "," + mabaiviet + ")\" src=\"images/icon/001_05.ico\"/><a style=\"text-decoration:none\" href=\"#\">&nbsp;&nbsp;&nbsp;" + tv.tenthanhvien + "</a></li>";
                }
            }
            else {
                str_inner += "<li><a style=\"text-decoration:none\" href=\"#\">&nbsp;&nbsp;&nbsp;" + tv.tenthanhvien + "</a></li>";
            }
        }
        str_inner += "</ul>";

        div_DSGroup.InnerHtml = str_inner;
    }
}
